﻿using Gp.Scripts.Data.Skills;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace Gp.Scripts.GUI {
    public class SkillModeSelectionButton : MonoBehaviour {
        [SerializeField] private TMP_Text text;
        [SerializeField] private Image selectingMark;
        
        private Button _button;
        public int Id { get; set; }
                
        public void OnInit(int index, SkillExecutionZone parent) {
            _button = GetComponent<Button>();
            Id = index;
            _button.onClick.AddListener(() => parent.MarkSelection(Id));
            Hide();
        }


        public void Render(SkillModeInfo skillModeInfo) {
            this.gameObject.SetActive(true);
            text.text = skillModeInfo.Text;
        }
        

        public void Hide() {
            this.gameObject.SetActive(false);
        }

        public void MarkSelecting() {
            selectingMark.gameObject.SetActive(true);
        }

        public void UnMarkSelecting() {
            selectingMark.gameObject.SetActive(false);
        }
    }
}